class Solution5 {
    public boolean isFun(TreeNode left,TreeNode right) {
        if(left==null && right==null) {
            return true;
        }
        if(left!=null && right==null) {
            return false;
        }
        if(left==null && right!=null) {
            return false;
        }
        if(left.val!=right.val) {
            return false;
        }
        return isFun(left.right,right.left) && isFun(left.left,right.right);
    }
    public boolean isSymmetric(TreeNode root) {
        if(root==null) return true;
        return isFun(root.left,root.right);
    }
}
public class lc101 {
}
